<script>
export default {
	data() {
		return {
			interstitialAd: null
		}
	},
	onLaunch() { },
	async onShow() {
		await this.$store.dispatch("GETCONFIGINFO");
		this.getInterstitialAd()
	},
	onHide() { },
	methods: {
		// 插屏广告
		getInterstitialAd() {
			if (wx.createInterstitialAd) {
				this.interstitialAd = wx.createInterstitialAd({
					adUnitId: this.$store.state.configInfo.adIds.interstitialAd,
				});
				this.interstitialAd.onLoad(() => {
					console.log("插屏 广告加载成功");
				});
				this.interstitialAd.onError((err) => {
					console.error("插屏广告加载失败", err);
				});
				this.interstitialAd.onClose(() => { });
			}
			if (this.interstitialAd) {
				this.interstitialAd.show();
			}
		},
	}
}
</script>

<style lang="scss">
/*每个页面公共css */
@import "@/uni_modules/uview-plus/index.scss";
</style>